

<%= error_messages_for 'submission' %>     

<p id="instruction">
This application has no time-out period. If you would like to save
your work and return to this application later, just click on the "Save
Draft"  button  before you complete your work session. You may return to
the application at a later time by just logging in with your selected
email address and  password.
<br/><br/>
You may print your work at any time.  To print, scroll down to the bottom of this form, and click the "Print" button.
<br/><br/>
This application does not  provide electronic spell check and
grammar features. For access to these features, please create your
application responses in a Word document and then cut and paste into
this application.
</p>

<div id="save_draft_message"></div>

<% for approval in @submission.approvals %> 
  <h6>Approver Comments</h6>
	<div class="form_question">
	<div class="form_element_label"><%= link_to approval.manager.display_name, :controller => "account", :action => "show", :id => approval.manager %> @ <%= approval.updated_at %></div> 
	<div class="form_element"><%= simple_format(approval.notes) %></div>                 
	</div>
<% end %>


<% form_for :submission, @submission, :url => {:action => 'update', :id => @submission}, :html => {:id => "submission_form", :name => 'submission_form_name'} do |f|%>

  <%= render :inline => @submission.cycle.seeker_form, 
           	 :locals => { :@submission_data => @submission_data } %>  

	<h6>Administrative Information</h6>
	<div class="form_question">
	<div class="form_element_label">Total Request</div> 
	<div class="form_element"><div id='total_cost'><%=h sprintf("$ %0.2f", @submission.total_cost) %></div></div>                 
	</div> 
	                
	<div class="form_instructions"> 
	If more than one school is represented by applicants on a grant application team, advance approval for participation in this grant application must be given to those team members by their respective principal(s). Only the lead applicant's principal will be electronically approving this grant for final submission for judging. 
	</div>                                          
	
	<div class="form_instructions">
	If your approver is not in the drop down list below, please email their name to <a href="mailto:grantworks@pisd.edu?subject=approval+manager">grantworks@pisd.edu</a>.  We will add that approver and send back a confirmation to you.  You may then choose the approver and submit your grant application.
	</div>
	
	<div class="form_question">
	<div class="form_element_label">Approval Manager</div> 
	<div class="form_element">
		<% if @submission.status.name != "Not Approved" -%>
		<%= select("submission", "manager_id", 
					Site.find(:all, :order => 'name', :include => 'manager').collect {|s| [ "#{s.name} - #{s.manager.display_name}", s.manager.id ] }, {:include_blank => true}) %>
		<% else -%>
			<%= hidden_field "submission", "manager_id" %> 
			<% manager = Manager.find(@submission.manager_id, :include => 'site') %>
			<%= "#{manager.site.name} - #{manager.display_name}" %>
		<% end -%>
		
	</div>                 
</div>
	<table>
		<tr>
			<td>
  <%= submit_tag 'Save Draft' %> 
			</td>    
			
			<td>
	<%= submit_tag 'Print' %>
			</td>
		</tr>
	</table>
			
<% end %>
	
            
<!-- I believe that this might be cause some users to loose data. >>glh
<%= observe_form 'submission_form', 
			:url => {:action => 'save_seeker_form', :id => @submission}, 
			:update => 'save_draft_message', 
			:frequency => 60 %>
-->
			
<%= observe_form 'submission_form', 
			:url => {:action => 'total_cost'}, 
			:update => 'total_cost', 
			:frequency => 10 %>
			
<script type="text/javascript">
//<![CDATA[               
Event.observe(window, 'load', enterToTab($('submission_form')));
//]]>
</script> 
